<template>
  <div
    class="heard-title-child"
    :class="{
      'heard-title-child': store.styleInfo.styleType === 1 ? true : false,
      'heard-title-child2': store.styleInfo.styleType === 2 ? true : false,
      'heard-title-child3': store.styleInfo.styleType === 3 ? true : false,
    }"
  >
    <div
      :class="{
        'title-left': store.styleInfo.styleType === 1 ? true : false,
        'title-left2': store.styleInfo.styleType === 2 ? true : false,
        'title-left3': store.styleInfo.styleType === 3 ? true : false,
      }"
    >
      <titleLeftIcon
        v-if="store.styleInfo.styleType === 1"
        iconSize="6px"
        :color="colorList5[store.styleInfo.colorType - 1].fontColor"
      />
      <titleLeftIcon
        v-if="store.styleInfo.styleType === 2"
        iconSize="48px"
        :color="colorList5[store.styleInfo.colorType - 1].fontColor"
      />
      <titleLeftIcon
        v-if="store.styleInfo.styleType === 3"
        iconSize="24px"
        :color="colorList5[store.styleInfo.colorType - 1].fontColor"
      />
    </div>
    <div
      class="title-center ellipsis"
      :class="{
        'title-center1': store.styleInfo.styleType === 1 ? true : false,
        'title-center2': store.styleInfo.styleType === 2 ? true : false,
        'title-center3': store.styleInfo.styleType === 3 ? true : false,
      }"
    >
      <div
        :class="{
          'title-center-color1': store.styleInfo.colorType === 1 ? true : false,
          'title-center-color2': store.styleInfo.colorType === 2 ? true : false,
          'title-center-color3': store.styleInfo.colorType === 3 ? true : false,
          'title-center-icon1': store.styleInfo.styleType === 1 ? true : false,
          'title-center-icon2': store.styleInfo.styleType === 2 ? true : false,
          'title-center-icon3': store.styleInfo.styleType === 3 ? true : false,
        }"
      >
        <span v-if="store.styleInfo.styleType == 1" class="time-Work">{{ props.centerTitle }}</span>
        <i
          v-if="store.styleInfo.styleType == 1"
          class="iconfonts"
          :style="{
            lineHeight: '70px',
            fontSize: '70px',
            color: colorList5[store.styleInfo.colorType - 1].fontColor,
          }"
        >
          &#xe66c;
        </i>

        <div v-else-if="store.styleInfo.styleType == 3" class="type3-style">
          <i
            class="iconfonts iconfonts-type3"
            :style="{
              opacity: '0.5',
              lineHeight: '55px',
              fontSize: '55px',
              color: colorList5[store.styleInfo.colorType - 1].fontColor,
            }"
          >
            &#xe66a;
          </i>
          <i
            class="iconfonts"
            :style="{
              opacity: '0.5',
              lineHeight: '64px',
              fontSize: '64px',
              color: colorList5[store.styleInfo.colorType - 1].fontColor,
            }"
          >
            &#xe66b;
          </i>
        </div>
      </div>
      <span
        class="title-center-text ellipsis"
        :style="{
          fontFamily: 'SourceHanSerifCN-Bold',
          color: colorList5[store.styleInfo.colorType - 1].fontColor,
        }"
        >{{ props.title }}</span
      >
    </div>
    <div
      class=""
      :class="{
        'title-right': store.styleInfo.styleType === 1 ? true : false,
        'title-right2': store.styleInfo.styleType === 2 ? true : false,
        'title-right3': store.styleInfo.styleType === 3 ? true : false,
      }"
    >
      <titleRightIcon
        v-if="store.styleInfo.styleType === 1"
        iconSize="6px"
        :color="colorList5[store.styleInfo.colorType - 1].fontColor"
      />
      <titleRightIcon
        v-if="store.styleInfo.styleType === 2"
        iconSize="48px"
        :color="colorList5[store.styleInfo.colorType - 1].fontColor"
      />
      <titleRightIcon
        v-if="store.styleInfo.styleType === 3"
        iconSize="24px"
        :color="colorList5[store.styleInfo.colorType - 1].fontColor"
      />
    </div>
  </div>
</template>

<script setup lang="ts">
import titleLeftIcon from './titleLeftIcon.vue';
import titleRightIcon from './titleRightIcon.vue';
import heardIcon from './heardIcon.vue';
import { colorList5 } from '../../data';
import { useProjectStore } from '@/store';
const store = useProjectStore();

const props = defineProps({
  title: {
    type: String,
    default: '暂无标题',
  },
  loopIndex: {
    type: Number,
    default: 2,
  },
  centerTitle: {
    type: String,
    default: '',
  },
  // 数据
});
</script>

<style lang="less" scoped>
@font-face {
  font-family: 'SJxingkai-C-Regular';
  src: url('https://static.jiyi.show/assets/font/SanJiXingKaiJianTi-Cu-2.ttf') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-size: 16px;
}
.heard-title-child {
  // width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
}

.title-center {
  display: flex;
}
.ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.title-center1 {
  min-width: 236px;
  max-width: 644px;
  padding: 0 50px;
}
.title-center2 {
  min-width: 180px;
  max-width: 384px;
  .title-center-text {
    width: 100%;

    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.1) 54%,
      rgba(255, 255, 255, 0) 100%
    );
  }
}
.title-center3 {
  min-width: 176px;
  max-width: 584px;
  padding: 0 20px;
}
.title-center-text {
  font-size: 34px;
  width: 100%;
  height: 52px;
  text-align: center;
  line-height: 52px;

  font-weight: bold;
}
.title-center-icon1 {
  position: absolute;
  left: 50%;
  top: -50px;
  width: 282px;
  height: 70px;
  transform: translateX(-50%);
}
.time-Work {
  position: absolute;
  left: calc(50% - 48px);
  top: 0px;
  z-index: 20;
  width: 96px;
  height: 115px;
  font-size: 96px;
  font-family: SJxingkai-C-Regular;
  font-weight: 400;
  color: #ffffff;
  line-height: 115px;
  background: linear-gradient(180deg, rgba(203, 185, 149, 0.5) 0%, rgba(203, 185, 149, 0) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title-center-icon3 {
  position: absolute;
  left: calc(50% - 32px);
  top: calc(50% - 32px);
  // transform: translateY(-50%);
}
.title-center-color1 {
  background: linear-gradient(180deg, #e9d5b0 0%, rgb(102, 41, 36, 0) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  // background: linear-gradient(bottom top, rgb(102, 41, 36, 0) 0%, #e9d5b0 100%);
  // -webkit-text-fill-color: transparent;
  // -webkit-background-clip: text;
  // -moz-background-clip: text;
  // background-clip: text;
}
.title-center-color2 {
  background: linear-gradient(180deg, #cbb995 0%, rgba(68, 60, 46, 0) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title-center-color3 {
  background: linear-gradient(180deg, #e9d5b0 0%, rgba(203, 185, 149, 0) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title-left {
}
.title-left2 {
  margin-right: -80px;
}
.title-left3 {
}
.title-right {
}
.title-right2 {
  margin-left: -80px;
}
.title-right3 {
}
.type3-style {
  position: relative;
}
.iconfonts-type3 {
  position: absolute;
  top: 5px;
  left: 5px;
  right: 0;
}
</style>
